/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ConfigPanel.java
 *
 * Created on 2009-7-25, 9:30:26
 */

package cn.openlab.test;

/**
 *
 * @author johnny
 */
public class ConfigPanel extends javax.swing.JPanel {

    /** Creates new form ConfigPanel */
    public ConfigPanel() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        rbMemory = new javax.swing.JRadioButton();
        rbJDBC = new javax.swing.JRadioButton();
        rbHibernate = new javax.swing.JRadioButton();
        jButton1 = new javax.swing.JButton();

        buttonGroup1.add(rbMemory);
        rbMemory.setLabel("Memory Implementation");

        buttonGroup1.add(rbJDBC);
        rbJDBC.setLabel("JDBC Implementation");

        buttonGroup1.add(rbHibernate);
        rbHibernate.setLabel("Hibernate Implementation");

        jButton1.setLabel("Save");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(rbHibernate)
                            .addComponent(rbJDBC)
                            .addComponent(rbMemory)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(50, 50, 50)
                        .addComponent(jButton1)))
                .addContainerGap(199, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addComponent(rbMemory)
                .addGap(31, 31, 31)
                .addComponent(rbJDBC)
                .addGap(38, 38, 38)
                .addComponent(rbHibernate)
                .addGap(38, 38, 38)
                .addComponent(jButton1)
                .addContainerGap(70, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if(rbMemory.isSelected()) {
        	UserDaoManager.TYPE = "cn.openlab.test.UserDAOMemoryImpl";
        } else if(rbJDBC.isSelected()) {
        	UserDaoManager.TYPE = "cn.openlab.test.UserDAOJDBCImpl";
        } else if(rbHibernate.isSelected()) {
        	UserDaoManager.TYPE = "cn.openlab.test.UserDAOHibernateImpl";
        }
    }//GEN-LAST:event_jButton1ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JRadioButton rbHibernate;
    private javax.swing.JRadioButton rbJDBC;
    private javax.swing.JRadioButton rbMemory;
    // End of variables declaration//GEN-END:variables

}
